package com.bai.localshop.controller.user;


import com.bai.localshop.pojo.vo.UserVoucherQueryVO;
import com.bai.localshop.result.Result;
import com.bai.localshop.service.VoucherService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 用户端代金券控制器
 */
@RestController("userVoucherController")
@RequestMapping("/api/user/vouchers")
@RequiredArgsConstructor
@Slf4j
public class VoucherController {
    private final VoucherService voucherService;
    /**
     * 查询已上架的优惠券
     */
    @GetMapping
    public Result<List<UserVoucherQueryVO>> queryVoucher(){
        return Result.success(voucherService.queryVoucher());
    }
}
